package com.hrt.manage.address.city.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hrt.bean.City;
import com.hrt.manage.address.city.dao.CityDao;
import com.hrt.manage.address.city.service.CityService;
@Service
public class CityServiceImpl implements CityService{
	@Autowired
	private CityDao cityDao;
	@Override
	public Long totalCount() {
		return cityDao.totalCount();
	}

	@Override
	public City getCityById(Long id) {
		return cityDao.getById(id);
	}

	@Override
	public void deleteById(Long[] ids) throws Exception {
		List<City> delResult = cityDao.getByIds(ids);
		for (City ct : delResult) {
			ct.setIsdelete(new Integer(1));
			cityDao.updateEntity(ct);
		}
		
	}

	@Override
	public void saveCity(City city) throws Exception {
		cityDao.saveEntity(city);
		
	}

	@Override
	public List queryByPage(int pageIndex, int pageSize) {
		return cityDao.queryByPage(pageIndex, pageSize);
	}

	@Override
	public void updateCity(City city) {
		cityDao.updateEntity(city);
		
	}

	@Override
	public List<City> getByProvinceCode(String provincecode) {
		return cityDao.getByProvinceCode(provincecode);
	}

	@Override
	public List queryByPage(String sql, int pageIndex, int pageSize) {
		return cityDao.queryByPage(sql, pageIndex, pageSize);
	}

}
